define([ "PDUtilDir/grid", "PDUtilDir/searchBlock" ], function(Grid,
		SearchBlock) {

	function init(cache, detailObj, searchObj) {
		SearchBlock.init('searchBlockId');
		var strObj = {
				detail : '<a href="javascript:angular.element(\'#SoptTicketSearchGirdDivId\').scope().detailSupport.run',
				detail_suffix : '">下单</a>'
				
			}, getStr = function(oper, id){
				return strObj[oper] + '(\'' + id + '\')' + strObj[oper + '_suffix'];
			};
		// 初始化
		return Grid({
			id : "SoptTicketSearchGirdDivId",
			pageSize : 10,
			multi : true,
			pagination : true,
			cache : false,
			layout : [ {
				name : "所属景区",
				field : "spotName",
				width : "10%"
			},{
				name : "供应商",
				field : "deptName",
				width : "10%"
			}, {
                name : "成本价格",
                field : "price"
            }, {
                name : "外卖价格",
                field : "salePrice"
            }, {
				name : "数量",
				field : "number",
				sort : true
			}, {
				name : "类型",
				field : "type",
				width : "10%",
				format : function(e) {
					return cache.typeMap.get(e.row.type);
				}
			}, {
				name : "操作",
				field : "id",
				format : function(e) {
					if(cache.currentOrgType.dictCode == 'D_SERVICE_ORG_GROUP')
						return getStr('detail', e.row.id);
					return '无';
				}
			} ],
			toolbar : [{
				name : "查询",
				icon : "fa fa-search",
				callback : function(event) {
					searchObj.run();
				}
			} ],
			data : {
				type : "URL",
				value : getServer() + "/flea/hclv/spotTicket/selectByDeptId.htmls"
			}
		});
	}
	return {
		init : init
	}
});